package edu.gd.Filter;

import edu.gd.dao.UserDao;
import edu.gd.entity.User;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class Sign_in implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest req=(HttpServletRequest)servletRequest;
        HttpServletResponse resp=(HttpServletResponse)servletResponse;
        //HttpSession session = req.getSession();
        //if(req.getRequestURL().indexOf("login")!=-1||req.getRequestURL().indexOf("regist")!=-1||req.getRequestURL().indexOf("shibai")!=-1||req.getRequestURL().indexOf("layui")!=-1||req.getRequestURL().indexOf("reset_pwd")!=-1||req.getRequestURL().indexOf("reset_pwd")!=-1)
          //  filterChain.doFilter(servletRequest, servletResponse);
        //else if(session.getAttribute("username")==null)
          //  resp.sendRedirect(req.getContextPath()+"/shibai.jsp");
        //else
            filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {

    }
}
